Merges two or more lists into a list of lists, combining elements from each of the input lists based on their positions.
.ππ»Use max() combined with a list comprehension to get the length of the longest list in the arguments.
.ππ»Use range() in combination with the max_length variable to loop as many times as there are elements in the longest list.
.ππ»If a list is shorter than max_length, use fill_value for the remaining items (defaults to None).
.ππ»zip() and itertools.zip_longest() provide similar functionality to this snippet.
Code:
def merge(*args, fill_value = None): max_length = max([len(lst) for lst in args]) result = [] for i in range(max_length): result.append([ args[k][i] if i < len(args[k]) else fill_value for k in range(len(args)) ]) return result
Merges two or more lists into a list of lists, combining elements from each of the input lists based on their positions.
.ππ»Use max() combined with a list comprehension to get the length of the longest list in the arguments.
.ππ»Use range() in combination with the max_length variable to loop as many times as there are elements in the longest list.
.ππ»If a list is shorter than max_length, use fill_value for the remaining items (defaults to None).
.ππ»zip() and itertools.zip_longest() provide similar functionality to this snippet.
Code:
def merge(*args, fill_value = None): max_length = max([len(lst) for lst in args]) result = [] for i in range(max_length): result.append([ args[k][i] if i < len(args[k]) else fill_value for k in range(len(args)) ]) return result
Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but itβs best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Letβs take a look at what Telegram can do and why you might want to use it.
Telegram hopes to raise $1bn with a convertible bond private placement
The super secure UAE-based Telegram messenger service, developed by Russian-born software icon Pavel Durov, is looking to raise $1bn through a bond placement to a limited number of investors from Russia, Europe, Asia and the Middle East, the Kommersant daily reported citing unnamed sources on February 18, 2021.The issue reportedly comprises exchange bonds that could be converted into equity in the messaging service that is currently 100% owned by Durov and his brother Nikolai.Kommersant reports that the price of the conversion would be at a 10% discount to a potential IPO should it happen within five years.The minimum bond placement is said to be set at $50mn, but could be lowered to $10mn. Five-year bonds could carry an annual coupon of 7-8%.